<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>

<!-- ========================= -->
<!-- root element: assemblyBuildAcknowledgement -->
<!-- ========================= -->


<xsl:template match="shipRequestAcknowledgement">

	<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <!-- ========================= -->
    <!-- gobal variables           -->
    <!-- ========================= -->

    <xsl:variable name="cancelImagePath" select="images//cancelImage"/>
    <xsl:variable name="bgColor" select="bgColor"/>
        <fo:layout-master-set>
            <fo:simple-page-master master-name="simpleA4"
                page-height="11in"
                page-width="8.5in"
                margin-top="5mm"
                margin-bottom="5mm"
                margin-left="17mm"
                margin-right="20mm" >

                <fo:region-before extent="30mm"/>

                <fo:region-after extent="7mm"/>


                <!-- ========================================================  -->
                <!-- Inorder to check whether Sort Release is cancelled or not -->
                <!-- ========================================================  -->

                <xsl:if test="@cancel='0'">
                <fo:region-body />
                </xsl:if>

                <xsl:if test="@cancel='1'">
                <fo:region-body background-image="{$cancelImagePath}" />
                </xsl:if>

            </fo:simple-page-master>
            </fo:layout-master-set>
        <fo:page-sequence master-reference="simpleA4">
            <fo:flow flow-name="xsl-region-body">
                <fo:table table-layout="fixed" width="95%" space-after="0.3cm" border="1pt double black" background-color="{$bgColor}">
                    <fo:table-column width="45mm"/>
                    <fo:table-column width="45mm"/>
                    <fo:table-column width="30mm"/>
                    <fo:table-column width="30mm"/>
                    <fo:table-body>
                        <fo:table-row background-color="#DEE1E2" >
                            <fo:table-cell  number-columns-spanned="4" border="0.5pt double black" hyphenate="true" display-align="center">
                                <fo:block  text-align="center" font-size="9pt" font-weight="bold">Ship Request</fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row space-before="10mm">

                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">From Location :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="fromVendorName"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Date :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="shipReqDate"/></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:apply-templates select="fromVendorAddress"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="top">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Ship Request Number :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="top">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="shipReqNumber"/></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Ship to Location :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="toVendorName"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:apply-templates select="toVendorAddress"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Shipper :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="shipperName"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Please send ship alerts to :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="shipAlerts"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell number-columns-spanned="4" hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Please ship the following product</fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Product :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="partNumber"/></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"> Total Qty :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="totalQty"/></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="center" font-size="7pt" font-weight="bold">Matrix Lot Number</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="right" font-size="7pt" font-weight="bold">Qty</fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <xsl:for-each select="/shipRequestAcknowledgement/lotDetails/lotData">

                            <fo:table-row>
                                <fo:table-cell hyphenate="true" display-align="center">
                                    <fo:block text-align="center" font-size="7pt"><xsl:value-of select="lotNumber"/></fo:block>
                                </fo:table-cell>
                                <fo:table-cell hyphenate="true" display-align="center">
                                    <fo:block text-align="right" font-size="7pt"><xsl:value-of select="qtyPulled"/></fo:block>
                                </fo:table-cell>
                                <fo:table-cell>
                                </fo:table-cell>
                                <fo:table-cell>
                                </fo:table-cell>
                            </fo:table-row>

                        </xsl:for-each>

                        <fo:table-row height="0.3cm">
                           <fo:table-cell hyphenate="true" display-align="center" number-columns-spanned="4">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold">Special Instructions :</fo:block>
                            </fo:table-cell>
                            <fo:table-cell number-columns-spanned="3" hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"></fo:block>
                            </fo:table-cell>
                            <fo:table-cell number-columns-spanned="3" hyphenate="true" display-align="center">
                                <fo:block  text-align="left" font-size="7pt" font-weight="bold"><xsl:value-of select="specialInstrs"/></fo:block>
                            </fo:table-cell>
                        </fo:table-row>

                    </fo:table-body>
                </fo:table>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>
</xsl:template>

<!--From Vendor Address Block -->
<xsl:template match="fromVendorAddress">
	<fo:table width="100%" table-layout="fixed">
		<fo:table-column />
		<fo:table-body>
			<fo:table-row>
				<fo:table-cell display-align="top">
				<fo:block><xsl:value-of select="contactPerson"/></fo:block>
				<fo:block><xsl:value-of select="address1"/></fo:block>
				<fo:block><xsl:value-of select="address2"/></fo:block>
				<fo:block><xsl:value-of select="address3"/></fo:block>
				<fo:block><xsl:value-of select="address4"/></fo:block>
                <fo:block><xsl:value-of select="city"/></fo:block>
                <fo:block><xsl:value-of select="state"/></fo:block>
				<fo:block><xsl:value-of select="phone"/></fo:block>
				<fo:block><xsl:value-of select="fax"/></fo:block>
                <fo:block><xsl:value-of select="cellno"/></fo:block>
                <fo:block><xsl:value-of select="email"/></fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
</xsl:template>
<!--To Vendor Address Block -->
<xsl:template match="toVendorAddress">
	<fo:table width="100%" table-layout="fixed">
		<fo:table-column />
		<fo:table-body>
			<fo:table-row>
				<fo:table-cell display-align="top">
				<fo:block><xsl:value-of select="contactPerson"/></fo:block>
				<fo:block><xsl:value-of select="address1"/></fo:block>
				<fo:block><xsl:value-of select="address2"/></fo:block>
				<fo:block><xsl:value-of select="address3"/></fo:block>
				<fo:block><xsl:value-of select="address4"/></fo:block>
                <fo:block><xsl:value-of select="city"/></fo:block>
                <fo:block><xsl:value-of select="state"/></fo:block>
				<fo:block><xsl:value-of select="phone"/></fo:block>
				<fo:block><xsl:value-of select="fax"/></fo:block>
                <fo:block><xsl:value-of select="cellno"/></fo:block>
                <fo:block><xsl:value-of select="email"/></fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
</xsl:template>
</xsl:stylesheet>



